package io.renren.modules.app.controller.info;

import java.util.Arrays;
import java.util.Map;

import io.renren.modules.app.entity.info.WorkYearEntity;
import io.renren.modules.app.service.info.WorkYearService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 *
 *
 * @date 2023-12-22 15:18:18
 */
@RestController
@RequestMapping("workyear")
public class WorkYearController {
    @Autowired
    private WorkYearService WorkYearService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = WorkYearService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		WorkYearEntity WorkYear = WorkYearService.getById(id);

        return R.ok().put("WorkYear", WorkYear);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody WorkYearEntity WorkYear){
		WorkYearService.save(WorkYear);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody WorkYearEntity WorkYear){
		WorkYearService.updateById(WorkYear);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		WorkYearService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
